

<!DOCTYPE html>
<html lang="zh-CN" >



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/image/icon/allenlzg128.jpg">
  <link rel="icon" href="/image/icon/allenlzg128.jpg">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="allenlzg">
  <meta name="keywords" content="">
  
    <meta name="description" content="简介Jenkins是个独立的开源软件项目，它是基于Java开发的一种持续集成工具，可用于实现各种任务的自动化，如构建，测试和部署等。项目的日常开发中，编译构建是每天频繁要做的事情，这都会占用或中断程序员不少宝贵的编码时间。借助Jenkins的自动化管理，任何人通过浏览器就可以一键完成以上工作，这样程序员只要专注于编码就可以了。 安装我们需要一台机器作为构建机，在它上面安装Jenkins,Cocos">
<meta property="og:type" content="article">
<meta property="og:title" content="使用Jenkins实现CocosCreator自动化构建">
<meta property="og:url" content="https://www.allenlzg.com/2023/3/23/cocosCreatorJenkins/index.html">
<meta property="og:site_name" content="我的博客">
<meta property="og:description" content="简介Jenkins是个独立的开源软件项目，它是基于Java开发的一种持续集成工具，可用于实现各种任务的自动化，如构建，测试和部署等。项目的日常开发中，编译构建是每天频繁要做的事情，这都会占用或中断程序员不少宝贵的编码时间。借助Jenkins的自动化管理，任何人通过浏览器就可以一键完成以上工作，这样程序员只要专注于编码就可以了。 安装我们需要一台机器作为构建机，在它上面安装Jenkins,Cocos">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://www.allenlzg.com/image/title/jenkins.png">
<meta property="article:published_time" content="2023-03-22T16:58:30.683Z">
<meta property="article:modified_time" content="2023-03-23T02:40:32.572Z">
<meta property="article:author" content="allenlzg">
<meta property="article:tag" content="Jenkins">
<meta property="article:tag" content="CocosCreator">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://www.allenlzg.com/image/title/jenkins.png">
  
  
    <meta name="referrer" content="no-referrer-when-downgrade">
  
  
  <title>使用Jenkins实现CocosCreator自动化构建 - 我的博客</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"www.allenlzg.com","root":"/","version":"1.9.4","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":true,"follow_dnt":true,"baidu":"2d3a73379a115abdee39be45a265e442","google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  

  
    <!-- Baidu Analytics -->
    <script async>
      if (!Fluid.ctx.dnt) {
        var _hmt = _hmt || [];
        (function() {
          var hm = document.createElement("script");
          hm.src = "https://hm.baidu.com/hm.js?2d3a73379a115abdee39be45a265e442";
          var s = document.getElementsByTagName("script")[0];
          s.parentNode.insertBefore(hm, s);
        })();
      }
    </script>
  

  

  

  

  

  

  



  
<meta name="generator" content="Hexo 6.2.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>阿刚的博客</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                <span>首页</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                <span>归档</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                <span>分类</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                <span>标签</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                <span>关于</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/image/bg/bg1.jpg') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="使用Jenkins实现CocosCreator自动化构建"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2023-03-23 00:58" pubdate>
          2023年3月23日 凌晨
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          2.4k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          21 分钟
        
      </span>
    

    
    
      
        <span id="busuanzi_container_page_pv" style="display: none">
          <i class="iconfont icon-eye" aria-hidden="true"></i>
          <span id="busuanzi_value_page_pv"></span> 次
        </span>
        
      
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">使用Jenkins实现CocosCreator自动化构建</h1>
            
            
              <div class="markdown-body">
                
                <h1 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h1><p>Jenkins是个独立的开源软件项目，它是基于Java开发的一种持续集成工具，可用于实现各种任务的自动化，如构建，测试和部署等。<br>项目的日常开发中，编译构建是每天频繁要做的事情，这都会占用或中断程序员不少宝贵的编码时间。借助Jenkins的自动化管理，任何人通过浏览器就可以一键完成以上工作，这样程序员只要专注于编码就可以了。</p>
<h1 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h1><p>我们需要一台机器作为构建机，在它上面安装Jenkins,CocosCreator,本文主要以mac系统为例。</p>
<h2 id="1-这里我们用homebrew-安装lts最新版本"><a href="#1-这里我们用homebrew-安装lts最新版本" class="headerlink" title="1.这里我们用homebrew 安装lts最新版本"></a>1.这里我们用homebrew 安装lts最新版本</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">brew install jenkins-lts<br></code></pre></td></tr></table></figure>
<h2 id="2-启动-Jenkins-服务"><a href="#2-启动-Jenkins-服务" class="headerlink" title="2.启动 Jenkins 服务"></a>2.启动 Jenkins 服务</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">brew services start jenkins-lts<br></code></pre></td></tr></table></figure>

<h2 id="3-登陆"><a href="#3-登陆" class="headerlink" title="3.登陆"></a>3.登陆</h2><p>安装完成后，打开浏览器输入地址：<a target="_blank" rel="noopener" href="http://localhost:8080/">http://localhost:8080/</a> ，按页面提示从本地复制密码并输入；</p>
<h2 id="4-创建管理员"><a href="#4-创建管理员" class="headerlink" title="4.创建管理员"></a>4.创建管理员</h2><p>创建第一个管理员用户。这是指Jenkins系统的管理员，因为Jenkins是个分布式平台，支持任意多个用户并行操作，不同用户有不同权限，所以在Jenkins第一次安装后需要立即创建一个管理员；</p>
<h2 id="5-增加局域网访问"><a href="#5-增加局域网访问" class="headerlink" title="5.增加局域网访问"></a>5.增加局域网访问</h2><p>打开 &#x2F;usr&#x2F;local&#x2F;Cellar&#x2F;jenkins-lts&#x2F;2.346.1&#x2F;homebrew.mxcl.jenkins-lts.plist<br>修改 httpListenAddress&#x3D;0.0.0.0<br>重新启动 Jenkins 服务</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">brew services restart jenkins-lts<br></code></pre></td></tr></table></figure>
<p>或者关闭在启动</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs shell">brew services stop jenkins-lts<br>brew services start jenkins-lts<br></code></pre></td></tr></table></figure>

<h1 id="自动化脚本"><a href="#自动化脚本" class="headerlink" title="自动化脚本"></a>自动化脚本</h1><p>本质上Jenkins是个可视化的Web管理工具，执行的各种任务其实都是通过命令完成的，我们要做什么任务，就为这个任务提供相应的命令。例如，Windows平台是批处理命令。<br>所以我们首先学会使用命令行来构建CocosCreator项目，之后才能在Jenkins中实现一键自动化构建和发布。</p>
<h2 id="使用shelljs-编写构建代码"><a href="#使用shelljs-编写构建代码" class="headerlink" title="使用shelljs 编写构建代码"></a>使用shelljs 编写构建代码</h2><p>为什么使用shelljs？请查看我的另外一篇文章 <a href="/2023/3/23/shelljs/" title="shelljs">shelljs</a><br>新建cocosbuild.js 脚本<br>1.gameUrl 为项目地址<br>2.CocosCreatorUrl CocosCreator安装地址<br>3.platform 打包平台<br>4.debug 是否打debug包<br>5.branch git 分支</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><code class="hljs javascript"><span class="hljs-keyword">var</span> shell = <span class="hljs-built_in">require</span>(<span class="hljs-string">&#x27;shelljs&#x27;</span>);<br><span class="hljs-keyword">var</span> argv = process.<span class="hljs-property">argv</span>;<br><span class="hljs-keyword">var</span> platform = argv[<span class="hljs-number">2</span>] || <span class="hljs-string">&quot;web-mobile&quot;</span>;<br><span class="hljs-keyword">var</span> debug =  argv[<span class="hljs-number">3</span>] || <span class="hljs-literal">false</span>;<br><span class="hljs-keyword">var</span> branch =  argv[<span class="hljs-number">4</span>] || <span class="hljs-string">&quot;develop&quot;</span>;<br><span class="hljs-keyword">var</span> gameUrl = <span class="hljs-string">&quot;/Users/lizhigang/test/cocosJenkinsTest&quot;</span>;<br><span class="hljs-keyword">var</span> <span class="hljs-title class_">CocosCreatorUrl</span> = <span class="hljs-string">&quot;/Applications/CocosCreator/Creator/2.4.8/CocosCreator.app/Contents/MacOS/CocosCreator&quot;</span>;<br><br><span class="hljs-comment">// 切换到工作目录</span><br>shell.<span class="hljs-title function_">cd</span>(gameUrl);<br><br><span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&quot;git更新&quot;</span>);<br><br><br><span class="hljs-comment">// 是否有对文件进行再次修改</span><br>shell.<span class="hljs-title function_">exec</span>(<span class="hljs-string">&quot;git status&quot;</span>);<br><span class="hljs-comment">//放弃工作区中全部的修改</span><br>shell.<span class="hljs-title function_">exec</span>(<span class="hljs-string">&quot;git checkout .&quot;</span>);<br><span class="hljs-comment">//删除未跟踪的目录和文件</span><br>shell.<span class="hljs-title function_">exec</span>(<span class="hljs-string">&quot;git clean -f -d&quot;</span>);<br><span class="hljs-comment">// 拉去远程代码</span><br>shell.<span class="hljs-title function_">exec</span>(<span class="hljs-string">&quot;git pull --no-edit&quot;</span>);<br><span class="hljs-comment">//切换到 指定分支</span><br>shell.<span class="hljs-title function_">exec</span>(<span class="hljs-string">&quot;git checkout &quot;</span> + branch);<br><span class="hljs-comment">//拉去远程代码</span><br>shell.<span class="hljs-title function_">exec</span>(<span class="hljs-string">&quot;git pull --no-edit&quot;</span>);<br><br><span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&quot;开始打包&quot;</span>)<br><br><br><span class="hljs-keyword">var</span> platform = <span class="hljs-string">&#x27;&quot;platform=&#x27;</span>+platform+<span class="hljs-string">&#x27;;&#x27;</span><br><span class="hljs-keyword">var</span> debugStr = <span class="hljs-string">&#x27;debug=&#x27;</span> + (debug ? <span class="hljs-string">&quot;true&quot;</span> : <span class="hljs-string">&quot;false&quot;</span>) + <span class="hljs-string">&#x27;;&quot;&#x27;</span><br><span class="hljs-keyword">if</span> (shell.<span class="hljs-title function_">exec</span>(<span class="hljs-title class_">CocosCreatorUrl</span> + <span class="hljs-string">&quot; --path &quot;</span> + gameUrl + <span class="hljs-string">&quot; --build &quot;</span> + platform + debugStr).<span class="hljs-property">code</span> !== <span class="hljs-number">0</span>) &#123;<br>    shell.<span class="hljs-title function_">echo</span>(<span class="hljs-string">&#x27;启动cocos打包失败&#x27;</span>);<br>    shell.<span class="hljs-title function_">exit</span>(<span class="hljs-number">1</span>);<br>&#125;<br><br><span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&quot;打包结束&quot;</span>);<br><br></code></pre></td></tr></table></figure>

<p>使用终端测试打包脚本</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">node cocosbuild.js web-mobile true develop<br></code></pre></td></tr></table></figure>

<p>打包成功 继续下一步配置jenkins</p>
<h1 id="配置jenkins"><a href="#配置jenkins" class="headerlink" title="配置jenkins"></a>配置jenkins</h1><p>1.新建任务 输入任务名称 HelloWorld 任务类型选择“自由风格的软件项目”，点击确定，就创建好了一个任务<br>2.增加构建参数 勾选参数化构建过程 点击添加参数<br><img src="/image/jenkins/%E5%8F%82%E6%95%B01.png" srcset="/img/loading.gif" lazyload><img src="/image/jenkins/%E5%8F%82%E6%95%B02.png" srcset="/img/loading.gif" lazyload><img src="/image/jenkins/%E5%8F%82%E6%95%B03.png" srcset="/img/loading.gif" lazyload><br>3.调用编写好的js脚本 构建 点击增加步骤 执行shell </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">node cocosbuild.js $platform $debug $branch<br></code></pre></td></tr></table></figure>
<p><img src="/image/jenkins/%E6%89%A7%E8%A1%8Cshell.png" srcset="/img/loading.gif" lazyload> </p>
<h1 id="开始打包"><a href="#开始打包" class="headerlink" title="开始打包"></a>开始打包</h1><p>1.点击 Build with Parameters，选择平台，选择是否打debug包，选择git分支，开始构建<br><img src="/image/jenkins/%E6%9E%84%E5%BB%BA.png" srcset="/img/loading.gif" lazyload> </p>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/Jenkins/">#Jenkins</a>
      
        <a href="/tags/CocosCreator/">#CocosCreator</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>使用Jenkins实现CocosCreator自动化构建</div>
      <div>https://www.allenlzg.com/2023/3/23/cocosCreatorJenkins/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>allenlzg</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2023年3月23日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2023/3/23/shelljs/" title="shelljs">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">shelljs</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2023/3/23/excelToJson/" title="excel 表格 转化 json lua">
                        <span class="hidden-mobile">excel 表格 转化 json lua</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
  
  
    <article id="comments" lazyload>
      
  <div id="twikoo"></div>
  <script type="text/javascript">
    Fluid.utils.loadComments('#comments', function() {
      Fluid.utils.createScript('https://cdn.staticfile.org/twikoo/1.6.4/twikoo.all.min.js', function() {
        var options = Object.assign(
          {"envId":"blog-5ge1xmpk3011c2ec","region":"ap-guangzhou","path":"window.location.pathname"},
          {
            el: '#twikoo',
            path: 'window.location.pathname',
            onCommentLoaded: function() {
              var imgSelector = '#twikoo .tk-content img:not(.tk-owo-emotion)';
              Fluid.plugins.imageCaption(imgSelector);
              Fluid.plugins.fancyBox(imgSelector);
            }
          }
        )
        twikoo.init(options)
      });
    });
  </script>
  <noscript>Please enable JavaScript to view the comments</noscript>


    </article>
  


          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
    <div class="statistics">
  
  

  
    
      <span id="busuanzi_container_site_pv" style="display: none">
        总访问量 
        <span id="busuanzi_value_site_pv"></span>
         次
      </span>
    
    
      <span id="busuanzi_container_site_uv" style="display: none">
        总访客数 
        <span id="busuanzi_value_site_uv"></span>
         人
      </span>
    
    
  
</div>

  
  
    <!-- 备案信息 ICP for China -->
    <div class="beian">
  <span>
    <a href="http://beian.miit.gov.cn/" target="_blank" rel="nofollow noopener">
      京ICP备2022020624号
    </a>
  </span>
  
    
      <span>
        <a
          href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=12345678"
          rel="nofollow noopener"
          class="beian-police"
          target="_blank"
        >
          
            <span style="visibility: hidden; width: 0">|</span>
            <img src="/img/police_beian.png" srcset="/img/loading.gif" lazyload alt="police-icon"/>
          
          <span>京公网安备12345678号</span>
        </a>
      </span>
    
  
</div>

  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.10/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>

  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
